package org.demo.base.jdbc;

import org.demo.base.jdbc.util.MyDataSource;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;

public class TestDatabase {
    public static void main(String[] args) throws SQLException {
        MyDataSource dataSource = new MyDataSource();

        dataSource.setDriverClass("com.mysql.jdbc.Driver");
        dataSource.setMaxSizes(1);
        dataSource.setMinSizes(1);
        dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/zhaofei");
        dataSource.setUsername("root");
        dataSource.setPassword("root");

        dataSource.init();



        Connection connection1 = dataSource.getConnection();
        System.out.println(connection1);
        Class<?>[] interfaces = connection1.getClass().getInterfaces();
        System.out.println(Arrays.toString(interfaces));
        connection1.close();
        Connection connection2 =dataSource.getConnection();
        System.out.println(connection2);
        Connection connection3 =dataSource.getConnection();
        System.out.println(connection3);
        Connection connection4 =dataSource.getConnection();
        System.out.println(connection4);
    }
}
